<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script setup>
import { onMounted, watch, computed } from 'vue';
import { useStore } from 'vuex';
import { useRouter } from 'vue-router';

const store = useStore();
const router = useRouter();

const wallpaper = computed(() => {
  let wallpaper = store.state.videoList[0];
  if (wallpaper) {
    wallpaper.type = 2;
  }
  return store.state.wallpaper || wallpaper;
});

const themeMode = computed(() => {
  if (store.state.setContent.sunrise) {
    if (store.state.moment === 'd') {
      return 'light';
    } else {
      return 'dark';
    }
  }
  return store.state.setContent.themeMode;
});

onMounted(() => {
  document.querySelector('html').classList = themeMode.value;
});

watch(themeMode, (val) => {
  document.querySelector('html').classList = val;
});
</script>

<style lang="less" scoped>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>    